//cnpm install jsonwebtoken --save
const jwt = require('jsonwebtoken');
const str = "hakfhdlkfjalfjalk"  //用于签名的字符串

//创建token
function createToken(obj) {
    obj.time = Date.now()  //{username:"admin",phone:"13673618137",time:"123456789"}
    return jwt.sign(obj, str, { expiresIn: 60 * 60 });
}

module.exports = {
    createToken
}




